import { defineConfig } from 'vite'
import * as path from 'path'
import { viteStaticCopy } from 'vite-plugin-static-copy'
export default defineConfig({
  plugins: [
    viteStaticCopy({
      targets: [
        {
          src: 'package.json',
          dest: './'
        }
      ]
    })
  ],
  resolve: {
    // 配置路径别名
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  build: {
    // 构建前清空输出目录
    emptyOutDir: false, 
    lib: {
      entry: path.resolve(__dirname, 'src/index.ts'),
      //构建好的文件名（不包括文件后缀）
      name: 'index',
      fileName: 'index',
      // formats: ['umd']
    },
    rollupOptions: {
      output: {
        globals: {
          yiyeLog: 'yiyeLog'
        }
      }
    }
  }
})